package com.srd.phone.mvp.presenters;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.srd.phone.application.HttpStringRequest;
import com.srd.phone.mvp.interfaces.IBaseView;

import java.util.Map;

public class TenderListPresenter extends BasePresenter {


    public TenderListPresenter(RequestQueue requestQueue, IBaseView iView0) {
        super(requestQueue, iView0);
    }

    /**
     * 请求数据
     */
    public void requestData(final String url, final Map<String, String> conMap) {
        HttpStringRequest request = new HttpStringRequest(Request.Method.POST, url, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                iView.get().returnData(url, response);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                iView.get().onError(url, error);
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = conMap;
                map.put("stat", "54,62");
                return map;
            }
        };
        request.setTag(url);
        requestQueue.add(request);
    }
}
